package com.maimao.goods.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.maimao.model.goods.Goods;
import com.maimao.model.goods.dto.GoodsClickDto;
import com.maimao.model.goods.input.GoodsSearch;
import com.maimao.model.goods.vo.GoodsVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.time.LocalDateTime;
import java.util.List;

/**
 * @author MaoLin Wang
 * @date 2020/12/22 8:04 下午
 */
@Mapper
public interface GoodsMapper extends BaseMapper<Goods> {
    List<Goods> selectAll();

    Goods selectByIdValid(Long goodsId);

    List<Goods> selectIdNameByShopId(@Param("shopId") Long shopId, @Param("key") String key);

    List<Goods> selectByShopId(@Param("shopId") Long shopId, @Param("goodsSearch") GoodsSearch goodsSearch);

    int addSellcount(@Param("id") Long id, @Param("sellCount") Integer sellCount);

    List<Goods> selecBatchtByIdValid(@Param("goodsIdList") List<Long> goodsIdList);

    int updateOnSell(@Param("id") Long goodsId, @Param("onSell") Integer onSell, @Param("deleteTime")LocalDateTime deleteTime);

    int updateByGId(@Param("goods") Goods goods);

    List<Goods> selectByIdBatch(@Param("goodsIdList") List<Long> goodsIdList);

    /**
     * 查询商品数量 根据时间
     */
    Integer total(@Param("createTime") LocalDateTime createTime);

    Long selectTotalClickCount();

    Long totalSellCount();

    int updateClickCountBatch(@Param("list") List<GoodsClickDto> list);

    Long selectBrandIdById(@Param("goodsId") Long goodsId);
}
